package com.loongnoy.listener;


import com.loongnoy.pojo.User;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
public class RabbitMQListener {

    // 监听短信队列（sms_queue）
    @RabbitListener(queues = "sms_queue")
    public void handleSms(User user) {
        System.out.println("向【" + user.getTel() + "】发送短信成功，内容：" +
            "恭喜您，【" + user.getUsername() + "】，注册成功！");
    }

    // 监听邮件队列（email_queue）
    @RabbitListener(queues = "email_queue")
    public void handleEmail(User user) {
        System.out.println("向【" + user.getEmail() + "】发送邮件成功，内容：" +
            "恭喜您，【" + user.getUsername() + "】，注册成功！");
    }
}